//! a rust implement for url-tool

#![deny(warnings)]
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]

#[cfg(feature = "bin")]
use structopt::StructOpt;

#[cfg(feature = "bin")]
use url_tool::{cli::Config, task::Task};

#[tokio::main]
async fn main() {
    #[cfg(debug_assertions)]
    {
        println!("{}", console::style("it is debug mold").cyan());
    }

    #[cfg(not(feature = "bin"))]
    {
        println!(
            "{} feature [{}] must be used for building",
            console::style("BUILD ERR").red().bold(),
            console::style("bin").cyan().bold()
        );

        std::process::exit(-1);
    }

    #[cfg(feature = "bin")]
    {
        let opt: Config = Config::from_args();
        let task = Task::from_config(&opt);
        task.start().await;
    }
}
